// ==UserScript==
// @name           Last.fm interwiki
// @namespace      http://spoo.free.fr/
// @description    Inserts links to other language biography on Last.fm
// @include        http://last.fm/music/*/+wiki
// @include        http://*.last.fm/music/*/+wiki
// @include        http://lastfm.*/music/*/+wiki
// @include        http://*.lastfm.*/music/*/+wiki
// ==/UserScript==

var h1 = document.getElementsByTagName('H1');
var bioHeader = h1 && h1[0] && h1[0].parentNode;
if(bioHeader) {
	var links = document.getElementsByTagName('HEAD')[0].getElementsByTagName('LINK');
	var html = [];
	for(var i = 0, iMax = links.length; i < iMax; i++) {
		if(links[i].rel == 'alternate') {
			html.push('<a href="'+links[i].href+'">'+links[i].hreflang+'</a>');
		}
	}

	bioHeader.innerHTML = '<span style="float: right;">Autres langues : ' + html.join(', ') + '</span>' + bioHeader.innerHTML;
}